This chapter describes how you can use the Thread Manager to provide threads, or multiple points of execution, in an application. You can think of the Thread Manager as an enhancement to the Process Manager, which still governs how applications work together in the Macintosh multitasking environment. Therefore, you should already be familiar with the concepts in Inside Macintosh: Processes and Inside Macintosh: Memory before reading this chapter.
Read this chapter if you are interested in developing an application with more than one thread (called a threaded application in this document). If your application uses no Thread Manager functions, the Process Manager treats it as a single-threaded application (called a nonthreaded application in this document).The Process Manager does call the Thread Manager at launch time to create the main thread for the application, but it does this transparently and in no way affects the performance of your application.
This chapter begins by describing the advantages of using threads within an application context. It describes the scheduling model that the Thread manager provides, the context information that the Thread Manager saves when it switches one thread out and another one in, and it describes thread stacks. It then shows how to